package com.clayecloud.lib_base.managers;

import androidx.lifecycle.MutableLiveData;

import java.util.HashMap;
import java.util.Map;

public class LiveDataManager {
    private static LiveDataManager liveDataManager = new LiveDataManager();
    private Map<String, MutableLiveData<Object>> map;
    private LiveDataManager(){
        map = new HashMap<>();
    }
    public static LiveDataManager getInstance(){
        return liveDataManager;
    }
    public<T> MutableLiveData<T> with(String key, Class<T> tClass){
        if(!map.containsKey(key)){
            map.put(key, new MutableLiveData<Object>());
        }
        return (MutableLiveData<T>) map.get(key);
    }
}
